package com.petmagics.learnanimation;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2015/4/12.
 */
public class MainFm extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View root = inflater.inflate(R.layout.fragment_main, container, false);

        root.findViewById(R.id.btnOpenAlpha).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new AlphaAnimationFm())
                        .commit();
            }
        });

        root.findViewById(R.id.btnOpenRotate).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new RotateAnimationFm())
                        .commit();
            }
        });

        root.findViewById(R.id.btnOpenTranslate).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new TranslateAnimationFm())
                        .commit();
            }
        });

        root.findViewById(R.id.btnOpenScale).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new ScaleAnimationFm())
                        .commit();
            }
        });

        root.findViewById(R.id.btnOpenBlending).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new AnimationBlendingFm())
                        .commit();
            }
        });
        root.findViewById(R.id.btnOpenCustom).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getFragmentManager().beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.container, new CustomAnimationFm())
                        .commit();
            }
        });

        return root;
    }
}
